package personal.shin.smsviewer;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.RectF;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.util.AttributeSet;
import android.widget.ImageView;

public class ProfileImageView extends ImageView{

	private int n = 5;
	private String color;
	
	 public ProfileImageView(Context context) {
		 super(context);
		  color = new String("#bebebe");		 
	 }

	 public ProfileImageView(Context context, AttributeSet attrs) {
		 super(context, attrs);
		  color = new String("#bebebe");		 
	 }
	 
	 public ProfileImageView(android.content.Context context, android.util.AttributeSet attrs, int defStyle) {
		 super(context, attrs, defStyle);
		  color = new String("#bebebe");		 
	 }
	 
	  public void setEdgeColor(String c)
	  {
		  color = c;
	  }

	  public String getEdgeColor()
	  {
		  return color;
	  }

	 @Override
	 protected void onDraw(Canvas canvas) { 
	  super.onDraw(canvas);
	  float[] outerR = new float[] { n,n,n,n,n,n,n,n };
	  RectF   inset = new RectF(5, 5, 5, 5); 
	  float[] innerR = new float[] { n,n,n,n,n,n,n,n };
	  ShapeDrawable mDrawables = new ShapeDrawable(new RoundRectShape(outerR, inset, innerR));
	  mDrawables.getPaint().setColor(Color.parseColor(getEdgeColor())); 
	  mDrawables.getPaint().setAntiAlias(true);
	  mDrawables.setBounds(-2,-2,getWidth()+1, getHeight()+1);
	  mDrawables.draw(canvas);
	 }
}
